#ifndef RESOURCELOCATOR_H
#define RESOURCELOCATOR_H

#include <string>
#include <vector>

//#include "bga/system/Tree.h"
#include "bga/system/ConfigDLL.h"
#include "bga/system/Singleton.h"
#include "bga/system/File.h"

namespace bga
{

/**
 * \class ResourceLocator
 * \brief This class will be used to determine the location of all type of resources : textures, models, ...
 *
 * This class will be used to determine the location of all type of resources : textures, models, ...
 * It will be used internally
 */
class BOARD_HELL_ENGINE ResourceLocator : public Singleton<ResourceLocator>
{
    friend class Singleton<ResourceLocator>;

    public:
        /**
         * Default Constructor
         */
        ResourceLocator();

        /**
         * Destructor
         */
        virtual ~ResourceLocator();

        /**
         * \brief search and return the complete path of the resource
         * \param filename : name of the resource
         * \return the path of the resource
         */
        std::string findCompletePath(const std::string& filename);

        /**
         * \brief search and return the file of the resource
         * \param file : file short named of the resource
         * \return the file of the resource
         */
        File findFile(const File& file);

        /**
         * \brief search and return the file of the resource
         * \param file : name of the file short named of the resource
         * \return the file of the resource
         */
        File findFile(const std::string& file);

        /**
         * \brief get all the path matching with a type of resource
         * \param type : type of the resource(texture, shader, ...)
         * \return the list of the path matching to the type
         */
        std::vector<std::string> getPaths(const std::string& type);

    private:
        //Tree<std::string> resourcesDir;   ///!< Tree of the directory

        /**
         * \brief parse the resource file configuration
         */
        void parseFile();

        /**
         * \brief create the resource file configuration
         */
        void createFile();

        std::vector<std::string> paths;   ///!< List of the resource paths

};

}

#endif // RESOURCELOCATOR_H

